#ifndef COOLPOOL_SIMULATION_ENTITIES_ENTITIESCONTAINER_H
#define COOLPOOL_SIMULATION_ENTITIES_ENTITIESCONTAINER_H

#include <map>
#include <boost/thread.hpp>
#include <vector>

#include "DynamicEntity.h"

namespace coolpool
{
	typedef std::vector<Entity *> EntitiesPointers;
	typedef std::vector<DynamicEntity *> DynamicEntitiesPointers;
	typedef std::map<int, EntitiesPointers> CustomTypesList;

	// Container of all entities of the simulation. For the whole simulation it is possible
	// to acces the entities only trough this object. The acces to some members is synchronized.
	// If some bigger changes are going to be done on the entities it is possible to lock the whole structure.
	// This is used when updating the simulation to the next step.
	class EntitiesContainer
	{
	public:

		EntitiesContainer(const std::vector<Entity *> & entities);

		virtual ~EntitiesContainer();

		// Returns all the entities.
		EntitiesPointers * getAll();

		// Returns only dynamic entities.
		DynamicEntitiesPointers * getDynamicEntities();

		// Returns only static entities.
		EntitiesPointers * getStaticEntities();

	private:

		// Container of all the entities.
		EntitiesPointers all_;

		// Container of only dynamic entities.
		DynamicEntitiesPointers dynamics_;

		// Container of only static entities.
		EntitiesPointers statics_;

		// Initialization of basic pointer lists.
		void initBasicTypesLists(const std::vector<Entity *> & entities);
	};
}

#endif
